| special thanks to Conrad Hughes and Graeme Williams, who posted very fast 
| integer-division assembler routines to comp.sys.acorn
| special thanks to Paul Moore for porting gawk and make from gnu-sources (freeware)
| special thanks to Paul Moore for porting icon8 from THE ICON PROJECT-sources (freeware)
| special thanks to Guido Thather for porting gawk_l from gnu-sources(freeware)
| thanks to The Free Software Foundation (gnu) 
| thanks to THE ICON PROJECT
| special thanks to Frank Lancaster for writing (porting) TLA (freeware)
*if "<!formula$dir>"="" then set !formula$dir <obey$dir>
*if "<formula$dir>"="" then *error 0 !formula08.!boot need to run 
*if "<formula$init>"="" OR "%0" ="" then *obey <formula$dir>.!init %*0 
*if "<icon$blocksize>"="" then error 1 set icon$blocksize
*if <icon$blocksize> < 110000 then error 1 icon$blocksize should >= 110000
| thanks to acorn for the not working  *wimpslot -min <formula$minwimpslot> -max <formula$minwimpslot>
*echo *wimpslot -min <formula$minwimpslot> -max <formula$minwimpslot> { > <formula$work>.wimpslot }
*obey <formula$work>.wimpslot  
*if "<formula_tlaconfig$dir>"="" then *set formula_tlaconfig$dir <formula$dir>
*if "<formula_go$dir>"="" then *set formula_go$dir <formula$dir>
*if "%0"="-listing" OR "%0"="-make" then *set formula$output %1 else *set formula$output "%0 "
*if "%0"="-listing" OR "%0"="-make" then *set formula$input %2  else *set formula$input "%1 "
*if "<formula$output>"=" " then *error 1 there is no outputfile
*if "<formula$input>"=" " then *error 1 there is no  inputfile
*set formula$warning true
*set formula$error true
*copy <!formula$dir>.unexpected <formula$work>.error ~c~vf
*access <formula$work>.error wr
*echo no warning { > <formula$work>.warning }
| do formula -> macro-conversion
*if "%0"<>"-make" then <iconx$path>iconx 2> <formula$work>.iconxerr <formula$dir>.formula082 -asm=TLA <formula$work>.target_asm <formula$input>
*if "%0"="-make" then  <iconx$path>iconx 2> <formula$work>.iconxerr <formula$dir>.formula082 -asm=TLA -make %*1 
|
| handle errors and warnings
|
*if "<formula$error>"="true" then *print <formula$work>.iconxerr { >> <formula$work>.error }
*remove <formula$work>.iconxerr
*if "<formula$error>"="true" then *run <formula$viewer> <formula$work>.error else *remove <formula$work>.error 
|
*if "<formula$error>"="true" then *set formula$warning false
|
*if "<formula$warning>"="true" then *run <formula$forkview> <formula$work>.warning else *remove <formula$work>.warning
|
| test if outputfile could exist
*if "%0"<>"-make" then *spool <formula$output> 
*if "%0"<>"-make" then *spool
| tla -bl listing
*spool <formula$work>.tlaerror 
*if "%0"<>"-make" AND "<formula$error>"<>"true" AND "%0"="-listing" then set SYS$returncode 1
*if "%0"<>"-make" AND "<formula$error>"<>"true" AND "%0"="-listing" then <tla$path>tla -bl <formula$work>.listing <formula$work>.target_asm %1 
*set tla$error <SYS$returncode>
*spool
*if "<tla$error>"<>"0" then *run <formula$viewer> <formula$work>.tlaerror else *remove <formula$work>.tlaerror
| tla -bl null:
*spool <formula$work>.tlaerror 
*if "%0"<>"-make" AND "<formula$error>"<>"true" AND "%0"<>"-listing" then set SYS$returncode 1
*if "%0"<>"-make" AND "<formula$error>"<>"true" AND "%0"<>"-listing" then <tla$path>tla -bl null: <formula$work>.target_asm %0
*set tla$error <SYS$returncode>
*spool
*if "<tla$error>"<>"0" then *run <formula$viewer> <formula$work>.tlaerror else *remove <formula$work>.tlaerror
*quit
